﻿using System.Runtime.InteropServices;

namespace ConsoleApp;

public class OsUser
{
    /// <summary>
    /// 锁屏
    /// </summary>
    [DllImport("user32.dll")]
    public static extern void LockWorkStation();
    
    /// <summary>
    /// 注销、重启、关机
    /// </summary>
    /// <param name="flags">0=注销;2=重启;1=关闭</param>
    /// <param name="reason"></param>
    /// <returns></returns>
    [DllImport("user32.dll")]
    public static extern int ExitWindowsEx(int flags, int reason);
}